Skip to content

Roles#10

Merged
marcomariscal merged 7 commits intomainfrom
roles
Sep 28, 2021
Merged

Roles#10
marcomariscal merged 7 commits intomainfrom
roles

Conversation

@devtooligan
Copy link

@devtooligan devtooligan commented Sep 26, 2021

This adds a new tab "Roles" which is similar to Contracts except instead of displaying events, the current roles are displayed.

Added some logic in updateEvents to determine the current roles. Basically just starts from the 1st event and iterates through, keeping track of who was granted/revoked which permissions.

Added a new prop to the redux store under contracts called "RoleNames". This is populated by making a call to www.4bytes.com api and providing the role name argument from the Grant/RevokeRole events.

@netlify
Copy link

netlify bot commented Sep 26, 2021

✔️ Deploy Preview for yield-protocol-info ready!

🔨 Explore the source changes: 702cb15

🔍 Inspect the deploy log: https://app.netlify.com/sites/yield-protocol-info/deploys/6152a54a94033b0008c8e436

😎 Browse the preview: https://deploy-preview-10--yield-protocol-info.netlify.app/


roleBytesSeen.forEach(async (hex_signature: any) => {
const promise = axios
.get('https://www.4byte.directory/api/v1/signatures/', { params: { hex_signature } })
Copy link
Author

@devtooligan devtooligan Sep 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the 4byte.directory api currently works, we can only query 1 signature at a time. However, I have been in touch with the site maintainer and submitted a pr to allow for querying multiple hex_signatures in one call.

tbh - Since we are probably just going to use these on a handful of contracts where the fn names won't change I could see an argument for hardcoding these into the initial state and just fetching unrecognized ones -- or perhaps even ditching the fetching altogether

Anyways, it works for now

Copy link
Contributor

@marcomariscal marcomariscal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful!

@marcomariscal marcomariscal merged commit 2f5df38 into main Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants